home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / ace102.lha / prgs / seq.b < prev    next >
Text File  |  1993-02-13  |  557b  |  44 lines

  1. { A test of sequential file commands & functions:
  2.  
  3.     WRITE#
  4.     PRINT#
  5.     INPUT#
  6.     LINE INPUT#
  7.     EOF
  8. }
  9.  
  10. '..some data
  11. x$="test"
  12. a=12.241
  13. qq=-2221
  14. b%=-32
  15. c&=665533
  16.  
  17. '...write to file
  18. open "O",1,"ram:test"
  19.   write #1,x$,a,b%,c&
  20.   write #1,qq
  21. close 1
  22.  
  23. '...read from file
  24. open "I",#2,"ram:test"
  25.  input #2,x$,a,b%,c&,qq
  26.  print x$;a;b%;c&;qq
  27. close #2
  28.  
  29. for i=1 to 3
  30.   print
  31.   '..append to file
  32.   open "A",3,"ram:test"
  33.     print #3,"HELLO"
  34.   close #3
  35.  
  36.   '..show modified file
  37.   open "I",4,"ram:test"
  38.   while not eof(4)
  39.    line input #4,x$
  40.    print x$
  41.   wend
  42.   close #4
  43. next
  44.